public class Employee {// 封装示例类
    // 私有成员变量
    private String employeeId;
    private String name;
    private double salary;

    // 构造方法
    public Employee(String employeeId, String name, double salary) {
        this.employeeId = employeeId;
        this.name = name;
        this.salary = salary;
    }

    // getter 方法
    public String getEmployeeId() {
        return employeeId;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    // setter 方法
    public void setName(String name) {
        this.name = name;
    }

    public void setSalary(double salary) {
        if (salary > 0) {
            this.salary = salary;
        } else {
            System.out.println("工资必须大于 0。");
        }
    }

    // 显示员工信息的方法
    public void displayInfo() {
        System.out.println("员工编号：" + employeeId);
        System.out.println("姓名：" + name);
        System.out.println("工资：" + salary);
    }


    // 主类，用于测试 Employee 类

    public static void main(String[] args) {
        // 创建 Employee 对象
        Employee employee = new Employee("E001", "张三", 5000.0);
        // 显示员工信息
        employee.displayInfo();

        // 修改员工姓名和工资
        employee.setName("李四");
        employee.setSalary(6000.0);
        // 再次显示员工信息
        employee.displayInfo();
    }
}

